package csel.model;

import junit.framework.Assert;
import junit.framework.TestCase;

import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 

public class EquippableItemTester extends TestCase{

	EquippableItem ei;
	public static void main(String args[]) 
	{ 
		junit.textui.TestRunner.run(MapTester.class); 
	} 
	
	@Before
	protected void setUp() throws Exception
	{

	}
	
	//do all of them at once because I'm lazy
	@Test
	public void testArmor()
	{
		int armorBonus = 4;
		int start = 3;
		ei = new Armor(armorBonus);
		ei.setTypeId("armor");
		Assert.assertEquals("chest", ei.getGoesOn());
		Assert.assertEquals(ei.applyArmorBonus(start), armorBonus + start);
		Assert.assertEquals(ei.applyOffenseBonus(start), start);
		Entity e = new Entity(new Summoner());
		boolean didTouch = ei.touch(e);

		//not really useful but a comparator is needed and not sure if I want to add that
		if(didTouch)
		{
			Assert.assertEquals("armor", e.getInventory().getEquippableItems().get(0).getTypeId());
		}
	}
		
		public void testWeapon()
		{
			int weaponBonus = 4;
			int start = 3;
			ei = new Weapon(weaponBonus);
			ei.setTypeId("weapon");
			Assert.assertEquals("hand", ei.getGoesOn());
			Assert.assertEquals(ei.applyOffenseBonus(start), weaponBonus + start);
			Assert.assertEquals(ei.applyArmorBonus(start), start);
			Entity e = new Entity(new Summoner());
			boolean didTouch = ei.touch(e);
		
		//not really useful but a comparator is needed and not sure if I want to add that
		if(didTouch)
		{
			Assert.assertEquals("weapon", e.getInventory().getEquippableItems().get(0).getTypeId());
		}
	}
	
	@After protected void tearDown() throws Exception 
	{ 
		super.tearDown();
	} 
}
